home *** CD-ROM | disk | FTP | other *** search
/ Java Internet Programming Reference Guide / Java Internet Programming Reference Guide.iso / autorun / java.dir / 00118_10b.txt < prev    next >
Encoding:
Text File  |  1996-01-12  |  12.8 KB  |  724 lines

  1. Description
  2.  
  3.  
  4.  
  5. Each link object is a location object. 
  6.  
  7. You can reference the link objects in your code by using the links property of the document object. The links property is an array that contains an entry for each link in a document. 
  8.  
  9. Properties
  10.  
  11. target 
  12.  
  13. Methods
  14.  
  15. xxx to be supplied 
  16.  
  17. Event handlers
  18.  
  19. onClick onMouseOver 
  20.  
  21. Examples
  22.  
  23.  
  24.  
  25. The following example creates a hypertext link to an anchor named javascript_intro. 
  26.  
  27.  
  28. <A HREF="#javascript_intro">Introduction to JavaScript</A>
  29.  
  30.  
  31.  
  32.  
  33.  
  34. The following example creates a hypertext link to a URL. 
  35.  
  36.  
  37. <A HREF="http://www.netscape.com">Netscape Home Page</A>
  38.  
  39.  
  40.  
  41.  
  42.  
  43. See also
  44.  
  45. anchor object links property 
  46. ------------------------------------------------------------------------
  47.  
  48.  
  49. location object (client)
  50.  
  51.  
  52.  
  53. The location object contains information on the current URL. 
  54.  
  55. Syntax
  56.  
  57.  
  58.  
  59. location.property
  60.  
  61.  
  62. property is one of the properties listed below. 
  63.  
  64. Description
  65.  
  66.  
  67.  
  68. xxx to be supplied 
  69.  
  70. Properties
  71.  
  72. hash host hostname href pathname port protocol search 
  73.  
  74. Methods
  75.  
  76. assign toString 
  77.  
  78. Event handlers
  79.  
  80.  
  81.  
  82. None. 
  83.  
  84. Examples
  85.  
  86.  
  87.  
  88. xxx to be supplied 
  89.  
  90. See also
  91.  
  92. xxx to be supplied 
  93. ------------------------------------------------------------------------
  94.  
  95.  
  96. Math object (common)
  97.  
  98.  
  99.  
  100. The built-in Math object has properties and methods for mathematical constants and functions. For example, the Math object's PI property has the value of pi. 
  101.  
  102. Syntax
  103.  
  104.  
  105.  
  106.  
  107. Math.propertyName
  108. or
  109. Math.methodName(parameters)
  110.  
  111.  
  112.  
  113.  
  114.  
  115. Description
  116.  
  117.  
  118.  
  119. You reference the constant PI as Math.PI. Constants are defined with the full precision of real numbers in JavaScript. 
  120.  
  121. Similarly, you reference Math functions as methods. For example, the sine function is Math.sin(argument), where argument is the argument. 
  122.  
  123. It is often convenient to use the with statement when a section of code uses several Math constants and methods, so you don't have to type "Math" repeatedly. For example, 
  124.  
  125.  
  126. with Math {
  127.    a = PI * r*r;
  128.    y = r*sin(theta)
  129.    x = r*cos(theta)
  130. }
  131.  
  132.  
  133.  
  134.  
  135.  
  136. Properties
  137.  
  138. E LN10 LN2 PI SQRT1_2 SQRT2 
  139.  
  140. Methods
  141.  
  142. abs acos asin atan ceil cos exp floor log max min pow random round sin sqrt tan 
  143.  
  144. Event handlers
  145.  
  146.  
  147.  
  148. None. Built-in objects do not have event handlers. 
  149.  
  150. Examples
  151.  
  152.  
  153.  
  154. xxx to be supplied 
  155.  
  156. See also
  157.  
  158. xxx to be supplied 
  159. ------------------------------------------------------------------------
  160.  
  161.  
  162. password object (client)
  163.  
  164.  
  165.  
  166. A password object is a text field on an HTML form. When the user enters text into the field, asterisks (*) hide anything entered from view. 
  167.  
  168. Syntax
  169.  
  170.  
  171.  
  172. To define a password object, use standard HTML syntax: 
  173.  
  174.  
  175. <INPUT
  176.    TYPE="password"
  177.    NAME="objectName"
  178.    [VALUE="textValue"]
  179.    SIZE=integer
  180.  
  181.  
  182.  
  183.  
  184.  
  185. Description
  186.  
  187.  
  188.  
  189. xxx to be supplied 
  190.  
  191. Properties
  192.  
  193. defaultValue name value 
  194.  
  195. Methods
  196.  
  197. focus blur select 
  198.  
  199. Event handlers
  200.  
  201.  
  202.  
  203. None. 
  204.  
  205. Examples
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212. <B>Password:</B> <INPUT TYPE="password" NAME="password" VALUE="" SIZE=25>
  213.  
  214.  
  215.  
  216.  
  217.  
  218. See also
  219.  
  220. xxx to be supplied 
  221. ------------------------------------------------------------------------
  222.  
  223.  
  224. radioButton object (client)
  225.  
  226.  
  227.  
  228. A radioButton object is a set of radio buttons on an HTML form. A set of radio buttons lets the user choose one item from a list. 
  229.  
  230. Syntax
  231.  
  232.  
  233.  
  234. To define a set of radio buttons, use standard HTML syntax with the addition of the onClick event handler: 
  235.  
  236.  
  237. <INPUT
  238.    TYPE="radio"
  239.    NAME="objectName"
  240.    VALUE="buttonValue"
  241.    [CHECKED]
  242.    [onClick="handlerText"]>   textToDisplay
  243.  
  244.  
  245.  
  246.  
  247.  
  248. NAME should contain the same value for all radio buttons in a group. 
  249.  
  250. Description
  251.  
  252.  
  253.  
  254. All radio buttons in a radio button group use the same name property. To access the individual radio buttons in your code, follow the object name with an index starting from zero, one for each button the same way you would for an array such as forms: document.forms[0].objectName[0] is the first, document.forms[0].objectName[1] is the second, etc. 
  255.  
  256. Properties
  257.  
  258. checked defaultChecked index length name value 
  259.  
  260. Methods
  261.  
  262. click 
  263.  
  264. Event handlers
  265.  
  266. onClick 
  267.  
  268. Examples
  269.  
  270.  
  271.  
  272. The following example defines a radio button group to choose among three catalogs. Each radio button is given the same name, NAME="choice", forming a group of buttons for which only one choice can be selected. The example also defines a text field that defaults to what was chosen via the radio buttons but that allows the user to type a nonstandard catalog name as well. JavaScript automatically sets the catalog name input field based on the radio buttons. 
  273.  
  274.  
  275. <INPUT TYPE="text" NAME="catalog" SIZE="20">
  276. <INPUT TYPE="radio" NAME="choice" VALUE="PRICEY"
  277.    onClick="form.catalog.value = 'top-of-the-line'"> It's really great!
  278. <INPUT TYPE="radio" NAME="choice" VALUE="MODEST"
  279.    onClick="form.catalog.value = 'middle-of-the-road'"> It's pretty good.
  280. <INPUT TYPE="radio" NAME="choice" VALUE="CHEAPO"
  281.    onClick="form.catalog.value = 'bargain-basement'"> It stinks!
  282.  
  283.  
  284.  
  285.  
  286.  
  287. See also
  288.  
  289. selection object 
  290. ------------------------------------------------------------------------
  291.  
  292.  
  293. reset object (client)
  294.  
  295.  
  296.  
  297. A reset object is a reset button on an HTML form. 
  298.  
  299. Syntax
  300.  
  301.  
  302.  
  303. To define a reset button, use standard HTML syntax with the addition of the onClick event handler: 
  304.  
  305.  
  306. <INPUT
  307.    [NAME="objectName"]
  308.    TYPE="reset"
  309.    VALUE="buttonText"
  310.    [onClick="handlerText"]>
  311.  
  312.  
  313. VALUE specifies the text to display on the button face and can be accessed using the value property. 
  314.  
  315. Description
  316.  
  317.  
  318.  
  319. A reset button resets all elements in a form to their defaults. 
  320.  
  321. Properties
  322.  
  323. name value 
  324.  
  325. Methods
  326.  
  327. click 
  328.  
  329. Event handlers
  330.  
  331. onClick 
  332.  
  333. Examples
  334.  
  335.  
  336.  
  337. The following example displays a text object containing "CA". If the user types a different state abbreviation in the text object and then clicks the Clear Form button, the original value of "CA" is restored. 
  338.  
  339.  
  340. <B>State: </B><INPUT TYPE="text" NAME="state" VALUE="CA" SIZE="2">
  341. <P><INPUT TYPE="reset" VALUE="Clear Form">
  342.  
  343.  
  344.  
  345.  
  346.  
  347. See also
  348.  
  349. button and submit objects 
  350. ------------------------------------------------------------------------
  351.  
  352.  
  353. selection object (client)
  354.  
  355.  
  356.  
  357. A selection object is a selection list or scrolling list on an HTML form. A selection list lets the user choose one item from a list. A scrolling list lets the user choose one or more items from a list. 
  358.  
  359. Syntax
  360.  
  361.  
  362.  
  363. To define a selection object, use standard HTML syntax with the addition of the onBlur, onChange, and onFocus event handlers: 
  364.  
  365.  
  366. <SELECT
  367.    NAME="objectName"
  368.    [SIZE="value"]
  369.    [MULTIPLE]
  370.    [onBlur="handlerText"]
  371.    [onChange="handlerText"]
  372.    [onFocus="handlerText"]>   <OPTION [SELECTED]>textToDisplay [ ... <OPTION>textToDisplay]
  373. <SELECT>
  374.  
  375.  
  376.  
  377.  
  378. SIZE specifies the number of options visible when the form is displayed. 
  379.  
  380. Description
  381.  
  382.  
  383.  
  384. You can reference the options of a selection object in your code by using the options property. The options property is an array that contains an entry for each option in a selection object. Each option has the properties listed below. 
  385.  
  386. The options on selection objects can be updated dynamically. xxx NYI. 
  387.  
  388. Properties
  389.  
  390.  
  391.  
  392. The selection object has the following properties: options selectedIndex 
  393.  
  394. The options property has the following properties: defaultSelected index selected text value 
  395.  
  396. Methods
  397.  
  398. click 
  399.  
  400. Event handlers
  401.  
  402. onBlur onChange onFocus 
  403.  
  404. Examples
  405.  
  406.  
  407.  
  408. The following example displays a selection list. 
  409.  
  410.  
  411. Choose the music type for your free CD:
  412. <SELECT NAME="music_type_single">
  413.    <OPTION SELECTED> R&B <OPTION> Jazz <OPTION> Blues <OPTION> New Age</SELECT>
  414. <P>Choose the music types for your free CDs:
  415. <BR><SELECT NAME="music_type_multi" MULTIPLE>
  416.    <OPTION SELECTED> R&B <OPTION> Jazz <OPTION> Blues <OPTION> New Age</SELECT>
  417.  
  418.  
  419.  
  420.  
  421.  
  422. See also
  423.  
  424. radioButton object options property 
  425. ------------------------------------------------------------------------
  426.  
  427.  
  428. string object (common)
  429.  
  430.  
  431.  
  432. A string object consists of a series of characters. 
  433.  
  434. Syntax
  435.  
  436.  
  437.  
  438. stringName.property|method
  439.  
  440.  
  441. stringName is the name of a string variable. 
  442. property is one of the properties listed below. 
  443. method is one of the methods listed below. 
  444.  
  445. Description
  446.  
  447.  
  448.  
  449. A string can be represented as a literal enclosed by single or double quotes; for example, "Netscape" or 'Netscape'. 
  450.  
  451. Properties
  452.  
  453. length 
  454.  
  455. Methods
  456.  
  457. anchor big blink bold charAt fixed fontcolor fontsize indexOf italics lastIndexOf link small strike sub substring sup toLowerCase toUpperCase 
  458.  
  459. Event handlers
  460.  
  461.  
  462.  
  463. None. Built-in objects do not have event handlers. 
  464.  
  465. Examples
  466.  
  467.  
  468.  
  469. The following statement creates a string variable. 
  470.  
  471.  
  472. var last_name = "Schaefer"
  473.  
  474.  
  475.  
  476.  
  477.  
  478. last_name.length is 8. 
  479. last_name.toUpperCase() is "SCHAEFER". 
  480. last_name.toLowerCase() is "schaefer". 
  481.  
  482. See also
  483.  
  484. text and textArea objects 
  485. ------------------------------------------------------------------------
  486.  
  487.  
  488. submit object (client)
  489.  
  490.  
  491.  
  492. A submit object is a submit button on an HTML form. 
  493.  
  494. Syntax
  495.  
  496.  
  497.  
  498. To define a submit button, use standard HTML syntax with the addition of the onClick event handler: 
  499.  
  500.  
  501. <INPUT
  502.    TYPE="submit"
  503.    NAME="objectName"
  504.    VALUE="buttonText"
  505.    [onClick="handlerText"]>
  506.  
  507.  
  508. VALUE specifies the text to display on the button face and can be accessed using the value property. 
  509.  
  510. Description
  511.  
  512.  
  513.  
  514. A submit button causes a form to be submitted. 
  515.  
  516. Clicking a submit button submits a form to the program specified by the form's action property. This action always loads a new page into the client; it may be the same as the current page, if the action so specifies or is not specified. 
  517.  
  518. Properties
  519.  
  520. name value 
  521.  
  522. Methods
  523.  
  524. click 
  525.  
  526. Event handlers
  527.  
  528. onClick 
  529.  
  530. Examples
  531.  
  532.  
  533.  
  534.  
  535. <INPUT TYPE="submit" NAME="submit_button" VALUE="Done">
  536.  
  537.  
  538.  
  539.  
  540.  
  541. See also
  542.  
  543. reset and button objects 
  544. ------------------------------------------------------------------------
  545.  
  546.  
  547. text object (client)
  548.  
  549.  
  550.  
  551. A text object is a text input field on an HTML form. A text field lets the user enter a word, phrase, or series of numbers. 
  552.  
  553. Syntax
  554.  
  555.  
  556.  
  557. To define a text object, use standard HTML syntax with the addition of the onBlur, on Change, onFocus, and onSelect event handlers: 
  558.  
  559.  
  560. <INPUT
  561.    TYPE="text"
  562.    NAME="objectName"
  563.    VALUE="textValue"
  564.    SIZE=integer
  565.    [onBlur="handlerText"]
  566.    [onChange="handlerText"]
  567.    [onFocus="handlerText"]
  568.    [onSelect="handlerText"]>
  569.  
  570.  
  571.  
  572.  
  573. Description
  574.  
  575.  
  576.  
  577. text objects can be updated dynamically by setting this.value 
  578.  
  579. xxx to be supplied 
  580.  
  581. Properties
  582.  
  583. defaultValue name value 
  584.  
  585. Methods
  586.  
  587. focus blur select 
  588.  
  589. Event handlers
  590.  
  591. onBlur onChange onFocus onSelect 
  592.  
  593. Examples
  594.  
  595.  
  596.  
  597.  
  598. <B>Last name:</B> <INPUT TYPE="text" NAME="last_name" VALUE="" SIZE=25>
  599.  
  600.  
  601.  
  602.  
  603.  
  604. See also
  605.  
  606. textArea and string objects 
  607. ------------------------------------------------------------------------
  608.  
  609.  
  610. textArea object (client)
  611.  
  612.  
  613.  
  614. A textArea object is a multiline input field on an HTML form. A textArea field lets the user enter words, phrases, or numbers. 
  615.  
  616. Syntax
  617.  
  618.  
  619.  
  620. To define a text area, use standard HTML syntax with the addition of the onBlur, onChange, onFocus, and onSelect event handlers: 
  621.  
  622.  
  623. <TEXTAREA
  624.    NAME="objectName"
  625.    ROWS="integer"
  626.    COLS="integer"
  627.    [onBlur="handlerText"]
  628.    [onChange="handlerText"]
  629.    [onFocus="handlerText"]
  630.    [onSelect="handlerText"]>   textToDisplay
  631. <TEXTAREA>
  632.  
  633.  
  634.  
  635.  
  636. textToDisplay allows only ASCII text, and new lines are respected. 
  637. ROWS and COLS define the physical size of the displayed input field in numbers of characters. 
  638.  
  639. Description
  640.  
  641.  
  642.  
  643. textArea objects can be updated dynamically. xxx need to explain how. (see text object) 
  644.  
  645. Properties
  646.  
  647. defaultValue name value 
  648.  
  649. Methods
  650.  
  651. focus blur select 
  652.  
  653. Event handlers
  654.  
  655. onBlur onChange onFocus onSelect 
  656.  
  657. Examples
  658.  
  659.  
  660.  
  661.  
  662. <B>Description:</B>
  663. <BR><TEXTAREA NAME="item_description" ROWS=6 COLS=55>
  664. Our storage ottoman provides an attractive way to
  665. store lots of CDs and videos--and it's versatile
  666. enough to store other things as well.
  667.  
  668. It can hold up to 72 CDs under the lid and 20 videos
  669. in the drawer below.
  670. </TEXTAREA>
  671.  
  672.  
  673.  
  674.  
  675.  
  676. See also
  677.  
  678. text and string objects 
  679. ------------------------------------------------------------------------
  680.  
  681.  
  682. window object (client)
  683.  
  684.  
  685.  
  686. A window object is the top-level object for each document, location, and history object group. 
  687.  
  688. Syntax
  689.  
  690. xxx to be supplied 
  691.  
  692. Description
  693.  
  694.  
  695.  
  696. The window object is the top-level object in the JavaScript client hierarchy. Because the existence of the current window is assumed, you don't have to reference the name of the window when you call its methods and assign its properties. For example, status="Jump to a new location" is a valid property assignment, and close() is a valid method call. 
  697.  
  698. The self and window properties are synonyms for the current window, and you can optionally use them to refer to the current window. For example, you can close the current window by calling either window.close() or self.close(). You can use these properties to make your code more readable, or to disambiguate the property assignment self.status from a form called status. 
  699.  
  700. See the methods and properties listed below for more examples. 
  701.  
  702. You can reference a window's frame objects in your code by using the frames property. The frames property is an array that contains an entry for each frame in a window. 
  703.  
  704. Properties
  705.  
  706. frames parent self top status defaultStatus 
  707.  
  708. Methods
  709.  
  710. alert close confirm open prompt setTimeout clearTimeout 
  711.  
  712. Event handlers
  713.  
  714. onLoad onUnload 
  715.  
  716. Examples
  717.  
  718.  
  719.  
  720. xxx to be supplied 
  721.  
  722. See also
  723.  
  724. document object frames property